package me.jessyan.armscomponent.app.mvp.model.mine;

import android.app.Application;

import com.google.gson.Gson;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

import javax.inject.Inject;

import io.reactivex.Observable;
import me.jessyan.armscomponent.commonsdk.core.ResultCodeHub;
import me.jessyan.armscomponent.commonsdk.http.BaseResponse;
import me.jessyan.armscomponent.app.R;
import me.jessyan.armscomponent.app.mvp.contract.mine.MineLearningListContract;
import me.jessyan.armscomponent.app.mvp.model.entity.LearnItem;


/**
 * <p>
 * Author: Taozebi
 * Date: 09/08/2021 20:49
 * Description: describe of this class
 */
@ActivityScope
public class MineLearningListModel extends BaseModel implements MineLearningListContract.Model {
    @Inject
    Gson mGson;
    @Inject
    Application mApplication;

    @Inject
    public MineLearningListModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }

    @Override
    public Observable<BaseResponse<List<LearnItem>>> getLearnList() {
        List<LearnItem> list = new ArrayList<>();
        LearnItem bean = new LearnItem();
        bean.setImage(R.drawable.public_ic_avatar);
        bean.setTitle("日排行榜");
        bean.setLevel("每六名");
        bean.setTime("0时0分0秒");
        bean.setDesc("ABC获取第一名");
        list.add(bean);

        LearnItem bean1 = new LearnItem();
        bean1.setImage(R.drawable.public_ic_avatar);
        bean1.setTitle("月排行榜");
        bean1.setLevel("每六名");
        bean1.setTime("0时0分0秒");
        bean1.setDesc("ABC获取第一名");
        list.add(bean1);

        LearnItem bean2 = new LearnItem();
        bean2.setImage(R.drawable.public_ic_avatar);
        bean2.setTitle("年排行榜");
        bean2.setLevel("每六名");
        bean2.setTime("0时0分0秒");
        bean2.setDesc("ABC获取第一名");
        list.add(bean2);

        BaseResponse<List<LearnItem>> response = new BaseResponse<>();
        response.setResult(list);
        response.setPage(1);
        response.setPageCount(10);
        response.setCode(ResultCodeHub.CODE_0);
        return  Observable.just(response).delay(1, TimeUnit.SECONDS);
    }
}